#ifndef __SYS_H
#define __SYS_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "type.h"
#include "stm32f1xx_hal.h"

#include "FreeRTOS.h"
#include "task.h"

#define DEVICE_LOGGER_SERIAL        (255)
#define DEVICE_LOGGER_LEVEL         (LOG__INFO)

#define system_malloc(m)      pvPortMalloc(m)
#define system_free(m)        vPortFree(m)

// #define SYS_PRINTF
#ifdef SYS_PRINTF
extern void outputc(int ch);
#endif

#define SYSTEM_TICK_MS      (1000/configTICK_RATE_HZ)
void MSR_MSP(u32 addr);
void Error_Handler(void);

// user
extern void system_clock_config(void);
extern void system_reboot(void);
extern uint32_t system_get_tick(void);
extern void system_delay_ms(uint32_t ms);
extern void system_iwdg_init(void);
extern void system_iwdg(void);
extern uint8_t system_file_xor(void *ptr);

#endif
